<?php

$REALASES_DIR = 'realases/php5/';
$DEVEL_DIR = 'devel/';

require $DEVEL_DIR . 'ITypoStrategy.php';
require $DEVEL_DIR . 'DevelTypoStrategy.php';

$oDevelStrategy = new DevelTypoStrategy();

$sTypoStrategyClass = 'class TypoStrategy implements ITypoStrategy {
    public function getProcessRegexRules() {
        return ' . var_export($oDevelStrategy->getProcessRegexRules(), true) . ';
    }
    public function getSafeBlocksRegex() {
        return ' . var_export($oDevelStrategy->getSafeBlocksRegex(), true) . ';
    }
}';

$sTypoClass = strtr(file_get_contents('devel/DevelTypo.php'), array(
    'DevelTypo' => 'Typo',
    '<?php' => '',
    '?>'    => '',
));

$sTypoStrategyInterface = strtr(file_get_contents('devel/ITypoStrategy.php'), array(
    '<?php' => '',
    '?>'    => '',
));

file_put_contents($REALASES_DIR . 'Typo.php', implode("\n\n", array(
    '<?php',
    file_get_contents('devel/header.txt'),
    $sTypoStrategyInterface,
    $sTypoClass,
    $sTypoStrategyClass,
    '?>',
)));

?>